package com.itheima.Example;
// 计算器

import java.util.Scanner;

public class ExampleDemo1 {
    public static void main(String[] args) {
        test();
    }

    public static void test() {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个整数：");
        int a = sc.nextInt();
        System.out.println("请输入一个运算符：");
        char c = sc.next().charAt(0);
        System.out.println("请输入一个整数：");
        int b = sc.nextInt();
        switch (c) {
            case '+':
                System.out.println(a + b);
                break;
            case '-':
                System.out.println(a - b);
                break;
            case '*':
                System.out.println(a * b);
                break;
            case '/':
                System.out.println(a / b);
                break;
            default:
                System.out.println("输入错误！");
        }
    }
}
